package fachlogik;

import java.awt.Color;
import java.awt.Component;

import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

import entities.Category;
import entities.Person;

public class PersonenCellRenderer extends JLabel implements ListCellRenderer {
public Component getListCellRendererComponent(JList list, Object value, int index,
        boolean isSelected, boolean cellHasFocus) {
    if (value != null) {
        setOpaque(true);
        Person p = (Person) value;
        this.setText(p.getUsername());
    }

    if (isSelected)
        setBackground(Color.LIGHT_GRAY);
    else
        setBackground(Color.white);

    return this;
}
}
